package com.jianying.day03;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * ClassName: Flink03_Submit
 * Package: com.atguigu.day03
 * Description:
 *
 * @Author: tubage
 * @Create: 2024/4/1 10:08
 * @Version: 1.0
 */
public class Flink03_Submit {
    public static void main(String[] args) throws Exception {
        // TODO 1 指定环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        // TODO 2 指定端口读取
        DataStreamSource<String> socketDS = env.socketTextStream("localhost", 8888);
        // TODO 3 打印输出
        socketDS.print();
        // TODO 4 提交作业
        env.executeAsync();

        // -----------------------------------
        // TODO 1 指定环境
        StreamExecutionEnvironment env1 = StreamExecutionEnvironment.getExecutionEnvironment();
        // TODO 2 指定端口读取
        DataStreamSource<String> socketDS1 = env1.socketTextStream("localhost", 8889);
        // TODO 3 打印输出
        socketDS1.print();
        // TODO 4 提交作业
        env1.executeAsync();
    }
}
